#!/usr/bin/env python
# -*- coding:utf-8 -*-


file_obj = file('E:\log.txt', 'r+')
#print file_obj.read()
line_list = file_obj.readlines()
my_list =[]
#my_list =["alex;123;2","eric;123;3"]
for ele in line_list:
	# "alex;123;1\n"
	line = ele.strip()
	# "alex;123;1"
	value_list = line.split(';')
	#["alex","123","1"]
	last_value = int(value_list[-1])
	# 最后一个数，转换成整型
	last_value += 1
	# 1 += 1   》 last_value =last_value + 1
	value_list[-1] = str(last_value)
	# 更新后的列表
	#["alex","123","2"]
	value_str = ';'.join(value_list)
	# "alex;123;2" 
	# "eric;123;3"
	my_list.append(value_str)
#my_list =["alex;123;2","eric;123;3"]

file_obj.seek(0)

my_str = '\n'.join(my_list)
file_obj.write(my_str)

#flush这行后来发的图片没有
#file_obj.flush()
file_obj.close()



	#values[0]
	#values[1]
	#values[2]